package com.example.demo.service.impl;

import com.example.demo.dao.ProjectRepository;
import com.example.demo.model.entity.ProjectModel;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class ProjectService {

    @Resource
    ProjectRepository projectRepository;

    public ProjectModel save(ProjectModel model) {
        return projectRepository.save(model);
    }


    public Page<ProjectModel> getProjectPage(Specification specification, Pageable pageable) {
        return projectRepository.findAll(specification, pageable);
    }


    public void delete(String projectId) {
        projectRepository.delete(projectId);
    }
}
